package com.gzpi.hwgggh.utils;

/**
 * @date : 2020-12-21 10:33
 **/
public class Result<T> {
    private String message;
    private boolean rs;
    private T data;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setRs(boolean rs) {
        this.rs = rs;
    }


    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T>Result<T> createError(String message, T data){
       return new Result(message,false,data);
    }
    public static <T>Result<T>  createSuccess(String message,T data){
        return new Result(message,true,data);
    }
    public static <T>Result<T> createError(String message){
        return new Result(message,false,null);
    }
    public static <T>Result<T> createSuccess(String message){
        return new Result(message,true,null);
    }

    public boolean isSuccess(){
            return rs;
        }

    public Result(String message, boolean rs, T data) {
            this.message = message;
            this.rs = rs;
            this.data = data;
    }

    public Result() {
    }
}
